<template>
  <div class="viewDiv">
    <div :id="containerId"></div>
  </div>
</template>

<script>
import * as v3dAppAPI from "../v3dApp/model.js";

export default {
  name: "V3DApp",

  data() {
    return {
      containerId: v3dAppAPI.CONTAINER_ID,
    };
  },

  app: null,

  mounted() {
    v3dAppAPI.createApp().then((app) => {
      this.$options.app = app;
    });
  },

  beforeDestroy() {
    if (this.$options.app) {
      this.$options.app.dispose();
      this.$options.app = null;
    }
  },
};
</script>

<style>
@import "../v3dApp/app.css";
.viewDiv {
  height: 68.2%;
  width: 100%;
  /* 使元素贴紧屏幕边缘 */
  position: absolute;
  /* background-color: aqua; */
  top: 0;
  left: 0;
}
</style>